package org.apache.zookeeper.inspector.manager;


public class ACLInfo {
	private boolean read = false;
	private boolean write = false;
	private boolean delete = false;
	private boolean admin = false;
	private boolean create = false;
	
	private String aclScheme;
	private String aclId;
	
	public void setAclId(String aclId) {
		this.aclId = aclId;
	}
	
	public void setAclScheme(String aclScheme) {
		this.aclScheme = aclScheme;
	}
	
	public String getAclId() {
		return aclId;
	}
	
	public String getAclScheme() {
		return aclScheme;
	}
	
	public boolean isRead() {
		return read;
	}
	public void setRead(boolean read) {
		this.read = read;
	}
	public boolean isWrite() {
		return write;
	}
	public void setWrite(boolean write) {
		this.write = write;
	}
	public boolean isDelete() {
		return delete;
	}
	public void setDelete(boolean delete) {
		this.delete = delete;
	}
	public boolean isAdmin() {
		return admin;
	}
	public void setAdmin(boolean admin) {
		this.admin = admin;
	}
	public boolean isCreate() {
		return create;
	}
	public void setCreate(boolean create) {
		this.create = create;
	}
	
	public String getAclPerms() {
		StringBuilder sb = new StringBuilder();
		boolean addedPerm = false;
		if (isRead()) {
			sb.append("Read");
			addedPerm = true;
		}
		if (addedPerm) {
			sb.append(", ");
		}
		if (isWrite()) {
			sb.append("Write");
			addedPerm = true;
		}
		if (addedPerm) {
			sb.append(", ");
		}
		if (isCreate()) {
			sb.append("Create");
			addedPerm = true;
		}
		if (addedPerm) {
			sb.append(", ");
		}
		if (isDelete()) {
			sb.append("Delete");
			addedPerm = true;
		}
		if (addedPerm) {
			sb.append(", ");
		}
		if (isAdmin()) {
			sb.append("Admin");
			addedPerm = true;
		}
		return sb.toString();
	}
	
	
}
